import { createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import {
  ArrowRight,
  Fold,
  Expand,
  MagicStick,
  Setting,
  FullScreen,
  ArrowDown,
  Cpu,
  SwitchButton,
  FolderDelete
} from '@element-plus/icons-vue'
export const constantRoutes = [
    {
      path: '/login',
      component: () => import('@/views/login.vue')
    },
    {
      path: '/',
      redirect: '/dashboard',
      component: () => import('@/layout/index.vue'),
      children: [
        {
          path: 'dashboard',
//           component: () => import('@/views/dashboard/index.vue'),
          component: () => import('@/views/dashboard/newHome.vue'),
          meta: { pname: '仪表盘', name: '' }
        },
        {
          path: 'system/user',
          component: () => import('@/views/system/user/index.vue'),
          meta: { pname: '系统管理', name: '用户管理' }
        },
        {
          path: 'system/role',
          component: () => import('@/views/system/role/index.vue'),
          meta: { pname: '系统管理', name: '角色管理' }
        },
        {
          path: 'system/menu',
          component: () => import('@/views/system/menu/index.vue'),
          meta: { pname: '系统管理', name: '菜单管理' }
        },
        {
          path: 'system/dict',
          component: () => import('@/views/system/dict/index.vue'),
          meta: { pname: '系统管理', name: '字典管理' }
        },
        {
          path: 'system/log/oper',
          component: () => import('@/views/system/log/oper.vue'),
          meta: { pname: '系统管理', name: '操作日志' }
        },
        {
          path: 'system/log/login',
          component: () => import('@/views/system/log/login.vue'),
          meta: { pname: '系统管理', name: '登录日志' }
        },
        {
          path: 'system/notice',
          component: () => import('@/views/system/notice/index.vue'),
          meta: { pname: '系统管理', name: '系统消息' }
        },
        {
          path: 'monitor/online',
          component: () => import('@/views/monitor/online/index.vue'),
          meta: { pname: '系统监控', name: '在线用户' }
        },
        {
          path: 'monitor/server',
          component: () => import('@/views/monitor/server/index.vue'),
          meta: { pname: '系统监控', name: '服务监控' }
        },
        {
          path: 'monitor/cache',
          component: () => import('@/views/monitor/cache/index.vue'),
          meta: { pname: '系统监控', name: '缓存监控' }
        },
        {
          path: 'zzjg/zzgl',
          component: () => import('@/views/zzjg/zzgl/index.vue'),
          meta: { pname: '组织机构', name: '组织管理' }
        },
        {
          path: 'rsgl/yggl',
          component: () => import('@/views/rsgl/index.vue'),
          meta: { pname: '人事管理', name: '员工管理' }
        },
        {
          path: 'attendance/group',
          component: () => import('@/views/attendance/group/index.vue'),
          meta: { pname: '考勤管理', name: '考勤组' }
        },
        {
          path: 'attendance/rule',
          component: () => import('@/views/attendance/rule/index.vue'),
          meta: { pname: '考勤管理', name: '考勤规则' }
        },
        {
          path: 'attendance/static',
          component: () => import('@/views/attendance/static/index.vue'),
          meta: { pname: '考勤管理', name: '考勤记录' }
        },
        {
          path: 'attendance/staticpage',
          component: () => import('@/views/attendance/staticpage/index.vue'),
          meta: { pname: '考勤管理', name: '考勤统计' }
        },
        {
          path: 'approval/index',
          component: () => import('@/views/approval/index.vue'),
          meta: { pname: '审批管理', name: '审批' }
        },{
          path: 'approval/apply',
          component: () => import('@/views/approval/applyApproval.vue'),
          meta: { pname: '审批管理', name: '申请审批' }
        },
        {
          path: 'approval/personal',
          component: () => import('@/views/approval/personal.vue'),
          meta: { pname: '审批管理', name: '个人审批' }
        }
      ]
    },
    {
      path: '/bigData',
      component: () => import('@/views/bigData/echar.vue'),
      meta: { pname: '大数据分析', name: '大数据分析' }
    },
    {
      path: '/:pathMatch(.*)',
      component: () => import('@/views/404.vue')
    }
  ]


export const asyncRoutes = [
  // lianxi,
  // question,
  // exam
]
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [...constantRoutes, ...asyncRoutes] // 合并数组
})
export default router